package edu.lsnu.equipment_management_system.mapper.select.nopaging;

import edu.lsnu.equipment_management_system.pojo.vo.out.session.UserVo;
import lombok.Data;
import org.apache.ibatis.annotations.Select;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.PropertySource;

/**
 * @author mzy
 * @Description
 * @date 2018/11/17
 */
public interface LoginCheckMapper {
    /**
     * @Description 查询用户的session内容，以及用户登陆验证需要的
     * @author mzy
     * @time 2018-11-19
     * @see
     * @return   edu.lsnu.equipment_management_system.pojo.vo.out.session.UserVo
     * @params  [userNo]
     */
    @Select("select \n" +
            "YHB.ZGH 'userNo',\n" +
            "YHB.XM 'userName',\n" +
            "YHB.MD5 'password',\n" +
            "YHB.YHLBDM 'roleNo',\n" +
            "DM_YJS.YJSDM 'teacherOfficeNo',\n" +
            "DM_YJS.YJSMC 'teacherOffice'\n" +
            "from YHB\n" +
            "inner join DM_YJS\n" +
            "on DM_YJS.YJSDM = YHB.YJSDM\n" +
            "where YHB.ZGH = #{userNo}")
    UserVo getUser(String userNo); // 50830025

    /**
     * @Description 查询管理员的session内容，以及管理员登陆验证需要的
     * @author mzy
     * @time 2018-11-19
     * @see 
     * @return   edu.lsnu.equipment_management_system.pojo.vo.out.session.UserVo
     * @params  [id]
     */
    /*
    @Select("select \n" +
            "YHB.ZGH 'userNo',\n" +
            "YHB.XM 'userName',\n" +
            "YHB.MD5 'password',\n" +
            "DM_YJS.YJSDM 'teacherOfficeNo',\n" +
            "DM_YJS.YJSMC 'teacherOffice'\n" +
            "from YHB\n" +
            "inner join DM_YJS\n" +
            "on DM_YJS.YJSDM = YHB.YJSDM\n" +
            "inner join DM_YHLB\n" +
            "on DM_YHLB.YHLBDM = YHB.YHLBDM\n" +
            "where YHB.ZGH = #{userNo} and DM_YHLB.YHLB = '系统管理员'")
    */
    @Select("select \n" +
            "YHB.ZGH 'userNo',\n" +
            "YHB.XM 'userName',\n" +
            "YHB.MD5 'password',\n" +
            "DM_YJS.YJSDM 'teacherOfficeNo',\n" +
            "DM_YJS.YJSMC 'teacherOffice'\n" +
            "from YHB\n" +
            "inner join DM_YJS\n" +
            "on DM_YJS.YJSDM = YHB.YJSDM\n" +
            "where YHB.ZGH = #{userNo} and YHB.YHLBDM = '01'")
    UserVo getAdmin(String userNo); // 50830083
}
